import React, { Component } from "react";
import { connect } from 'react-redux'
import {actionCreators} from './store'
import  { withRouter } from 'react-router-dom'
import './style.css'
class   Detail extends Component{
    render  () {
        const {title,content } =this.props
        return(<div>
            <p className="newTitle">{title}</p>
            <div dangerouslySetInnerHTML={{__html:content}}>
             </div>
        </div>)
    }
    componentDidMount(){
        console.log(3333333333333,this.props.match.params)
            this.props.getDetail(this.props.match.params.id)
    }
}
const mapStateToProps = (state, ownProps) => {
    return {
        title: state.getIn(["news",'title']),
        content: state.getIn(["news",'content']),
    }
}
const mapDispatchToProps = (dispatch, ownProps) => {
    return {
        getDetail: (id) => {
            console.log("^&&^*cccc",id)
            dispatch(actionCreators.detail(1))
        }
    }
}
export default connect(mapStateToProps,mapDispatchToProps)(withRouter(Detail))